#! /bin/sh

name=texinfo
version=7.2
revision=1
tarball_url="https://ftp.gnu.org/pub/gnu/texinfo/texinfo-${version}.tar.xz"
tarball_blake2b="fc6bd020310a437a73d5723d257ca3da1d15329e9e668fa78c49ac77759c2c990d4422c2a7071b217ea214b88389a0cbb43d3fcfa5fe9bf9651270167b15c342"
source_imagedeps="build-essential"
imagedeps="build-essential help2man"
hostdeps="gcc pkg-config"
deps="core-libs ncurses bash gzip"

prepare() {
    autotools_recursive_regen

    mkdir build && cd build
    ../configure \
        CFLAGS="$HOST_CFLAGS" \
        CPPFLAGS="$HOST_CPPFLAGS" \
        LDFLAGS="$HOST_LDFLAGS"

    make -j${parallelism}
    make -C info makedoc

    cd ..
    mv build/info/makedoc info/
    rm -rf build
}

configure() {
        texinfo_cv_sys_iconv_converts_euc_cn=y \
    autotools_configure \
        --disable-perl-xs

    mkdir -p tools/info
    cp -v "${source_dir}"/info/makedoc tools/info/
}

build() {
    make -j${parallelism}
}

package() {
    DESTDIR="${dest_dir}" make install

    post_package_strip
}
